import { resultSuccess, resultError, getRequestToken, requestParams } from '../_util';
import { createFakeUserList } from './user';

// single

const announcementRoute = {
  name: '公告管理',
  icon: 'mingcute:announcement-fill',
  id: 234,
  url: '/noticeAdmin',
  menus: [
    {
      name: '公告列表',
      icon: '',
      id: 806,
      url: '/noticeAdmin',
    },
    {
      name: '历史公告',
      icon: '',
      id: 807,
      url: '/historyNotice',
    },
  ],
};
export default [
  {
    url: '/basic-api/getMenuList',
    timeout: 1000,
    method: 'get',
    response: (request: requestParams) => {
      const token = getRequestToken(request);
      if (!token) {
        return resultError('Invalid token!');
      }
      const checkUser = createFakeUserList()[0];
      if (!checkUser) {
        return resultError('Invalid user token!');
      }

      return resultSuccess([announcementRoute]);
    },
  },
];
